<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ShopGoodsPics extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
      Schema::create('shop_goods_pics', function (Blueprint $table) {
          $table->increments('id');
          $table->bigInteger('goods_id')->unsigned();  // 商品id
          $table->string('pic1', 255);                 // 商品图片1
          $table->string('pic2', 255);                 // 商品图片2
          $table->string('pic3', 255);                 // 商品图片3
          $table->string('pic4', 255)->nullable();          // 商品图片4
          $table->string('pic5', 255)->nullable();         // 商品图片5
          $table->timestamps();

          $table->foreign('goods_id')
              ->references('id')->on('shop_goods')
              ->onDelete('cascade');
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_goods_pics');
    }
}
